Skip to content

Conversation

@MathijsVerbeeck
Copy link
Contributor

Closes #6654

@MathijsVerbeeck MathijsVerbeeck changed the title Adds spo site alert get command. Closes #6654 Adds spo tenant site get command. Closes #6654 Oct 14, 2025
@MathijsVerbeeck MathijsVerbeeck force-pushed the add-spo-tenant-site-get branch from 6686856 to 4f4bf90 Compare October 14, 2025 18:38
@MartinM85 MartinM85 self-assigned this Dec 7, 2025
Copy link
Contributor

@MartinM85 MartinM85 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work @MathijsVerbeeck

I have a couple of small comments, nothing major.


const optionsSchema = globalOptionsZod
.extend({
id: zod.alias('i', z.string().refine(id => validation.isValidGuid(id), { message: 'Specify a valid GUID' }).optional()),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
id: zod.alias('i', z.string().refine(id => validation.isValidGuid(id), { message: 'Specify a valid GUID' }).optional()),
id: zod.alias('i', z.string().uuid().optional()),


export default new SpoTenantSiteGetCommand();


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

});

it('fails validation when specifying none of id, title, url', async () => {
const commandOptionsSchema = commandInfo.command.getSchemaToParse()!;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please define the commandOptionsSchema only once in the spec file.

let commandOptionsSchema: z.ZodTypeAny;
...
before(() => {
    ...
    commandOptionsSchema = commandInfo.command.getSchemaToParse()!;
  });


sinon.stub(spo, 'getSiteAdminPropertiesByUrl').resolves(siteResponse);

await command.action(logger, { options: { title: 'Marketing', verbose: true } });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please parse the command options.

Suggested change
await command.action(logger, { options: { title: 'Marketing', verbose: true } });
await command.action(logger, { options: commandOptionsSchema.parse({ title: 'Marketing', verbose: true }) });

Same for other tests.

@MartinM85 MartinM85 marked this pull request as draft December 7, 2025 17:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

New command: spo tenant site get

2 participants